#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <string.h>

int main()
{

FILE *f=NULL;
int i,j=0;

char login[30],ch;
char pass[30],password[30];
f = fopen("test.txt", "w");  /*read
*/


printf("Entrez login : ");
      scanf("%s", login);

printf ("Entrez mot de passe : ");
scanf ("%s", pass);
      fprintf(f, "login : %s\n", login);
      fprintf(f, "mot de passe : %s\n", pass);
      fclose(f);

f = fopen("test.txt", "r");  /*read
*/
  while (!feof(f))
     {
      fscanf(f, "%c",&ch);
      printf("%c",ch);

     }
  fclose(f);

   printf("\nPassword : ");
   do

    {
        j++;
password[j] = getch();

if(password[j] != 13){
     printf("*");}


      }while(password[j] != 13 );
      //hedhi bch nvirifou beha edha ken njoum 5dhéw elli saisinehom bel clavier 3anna mochkla fi supprimer
printf("\n");

 printf("votre mot de passe est : ");
      for (i=1;i<=j;i++){
      printf ("%c",password[i]);}


if( strcmp(pass,password)==0)//hedhi mte3 comparaison mana3rch famma mochkla mte3 affichage

  {
      printf("ok bienvenue ");
  }
  else {printf ("mauvais mot de passe ");}






    return 0 ;
}

